<style lang="scss" scoped>
#cmain {
    .mainContent {
        min-height: 425px;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0px 0px 15px 0px rgba(207, 207, 207, 1);
        padding-top: 10px;
        padding: 0px 30px;
        .table-title {
            height: 54px;
            line-height: 54px;
            margin-bottom: 20px;
            font-size: 16px;
            font-weight: 800;
            color: rgba(102, 102, 102, 1);
            border-bottom: 1px solid #dcdfe6;
        }
        .el-input--mini .el-input__inner {
            width: 202px;
        }
        .smok-drink .el-input__inner {
            width: 100%;
        }
        #my-table-title {
            height: 50px;
            line-height: 50px;
            text-align: center;
            background: #eef1f6;
            font-size: 14px;
            color: #2b3245;
        }
        .MyMainTable {
            padding: 10px 0px;
            border-bottom: 1px solid #eef1f6;
            .el-col {
                text-align: center;
            }
            .el-icon-plus:before {
                color: #337aba;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-icon-minus:before {
                color: #e51c23;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-form-item--mini.el-form-item {
                margin-bottom: 1px !important;
            }
            .el-form-item--mini .el-form-item__content {
                margin-left: 0px !important;
            }
            .el-input--mini .el-input__inner {
                width: 100%;
            }
        }
    }
}
</style>

<template>
    <div id="cmain" class="family-tree-mask" v-loading="loading" element-loading-text="数据加载中，请稍等......">
        <div class="mainContent">
            <el-form ref="datas" :model="datas" size="mini" label-width="200px" label-position="left">
                <!--临床与治疗信息  -->
                <div class="table-title">临床与治疗信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="组织病理类型">
                            <el-select v-model="datas.pathology_type" placeholder="请选择病理类型">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="高级别浆液性癌" value="1"></el-option>
                                <el-option label="内膜样癌" value="2"></el-option>
                                <el-option label="透明细胞癌" value="3"></el-option>
                                <el-option label="粘液性癌" value="4"></el-option>
                                <el-option label="低级别浆液性癌" value="5"></el-option>
                                <el-option label="恶性生殖细胞肿瘤" value="6"></el-option>
                                <el-option label="恶性性索间质肿瘤" value="7"></el-option>
                                <el-option label="癌肉瘤" value="8"></el-option>
                                <el-option label="交界性上皮性卵巢肿瘤" value="9"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="FIGO分期">
                            <el-select v-model="datas.figo" placeholder="请选择FIGO分期">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="I期" value="1"></el-option>
                                <el-option label="IA期" value="2"></el-option>
                                <el-option label="IB期" value="3"></el-option>
                                <el-option label="IC期" value="4"></el-option>
                                <el-option label="IC1期" value="5"></el-option>
                                <el-option label="IC2期" value="6"></el-option>
                                <el-option label="IC3期" value="7"></el-option>
                                <el-option label="II期" value="8"></el-option>
                                <el-option label="IIA期" value="9"></el-option>
                                <el-option label="IIB期" value="10"></el-option>
                                <el-option label="III期" value="11"></el-option>
                                <el-option label="IIIA期" value="12"></el-option>
                                <el-option label="IIIA（i）" value="13"></el-option>
                                <el-option label="IIIA（ii）" value="14"></el-option>
                                <el-option label="IIIA2期" value="15"></el-option>
                                <el-option label="IIIB期" value="16"></el-option>
                                <el-option label="IIIC期" value="17"></el-option>
                                <el-option label="IV期" value="18"></el-option>
                                <el-option label="IVA" value="19"></el-option>
                                <el-option label="IVB" value="20"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="服用口服避孕药">
                            <el-radio-group v-model="datas.oral_contraceptive">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="连续服用时间" v-if="datas.oral_contraceptive==1">
                            <el-select v-model="datas.oral_contraceptive_time" placeholder="请选择服用时间">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜6个月" value="1"></el-option>
                                <el-option label="＞6个月" value="2"></el-option>
                                <el-option label="3-5年" value="3"></el-option>
                                <el-option label="＞5年" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否绝经">
                            <el-radio-group v-model="datas.menopause">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="绝经年龄" v-if="datas.menopause==1">
                            <el-select v-model="datas.menopause_age">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜55岁" value="2"></el-option>
                                <el-option label="≥55岁" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="初次月经年龄">
                            <el-select v-model="datas.primary_age">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜12岁" value="1"></el-option>
                                <el-option label="≥12岁" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="生育情况">
                            <el-select v-model="datas.fertility_circumstance">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="已生育" value="1"></el-option>
                                <el-option label="未生育" value="2"></el-option>
                                <el-option label="不孕不育" value="3"></el-option>
                                <el-option label="选择不生育" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="初次生育年龄" v-if="datas.fertility_circumstance==1">
                            <el-select v-model="datas.first_childbearing_age">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜25岁" value="1"></el-option>
                                <el-option label="25-30岁" value="2"></el-option>
                                <el-option label="≥30岁" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="子女个数" v-if="datas.fertility_circumstance==1">
                            <el-select v-model="datas.children_number">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="1个" value="1"></el-option>
                                <el-option label="2个" value="2"></el-option>
                                <el-option label="3个" value="3"></el-option>
                                <el-option label="＞3个" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否母乳喂养"  v-if="datas.fertility_circumstance==1">
                            <el-radio-group v-model="datas.breast_feeding">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="哺乳时间" v-if="datas.breast_feeding==1">
                            <el-select v-model="datas.nursing_time">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜半年" value="1"></el-option>
                                <el-option label="＜1年" value="2"></el-option>
                                <el-option label="≥1年" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="是否伴有腹膜癌">
                            <el-radio-group v-model="datas.peritoneal_cancer">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否进行激素代替疗法">
                            <el-radio-group v-model="datas.hrt">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否进行过铂类化疗">
                            <el-radio-group v-model="datas.platinum_chemotherapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="化疗次数" v-if="datas.platinum_chemotherapy==1">
                            <el-input v-model="datas.pcn" placeholder="请输入化疗次数"></el-input>
                        </el-form-item>
                        <el-form-item label="是否对铂类敏感">
                            <el-radio-group v-model="datas.is_sensitive_platinum">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="激素治疗史">
                            <el-select v-model="datas.hh">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="雌激素治疗" value="1"></el-option>
                                <el-option label="孕激素治疗" value="2"></el-option>
                                <el-option label="雌激素受体调节剂" value="3"></el-option>
                                <el-option label="孕激素受体调节剂" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否进行过免疫治疗">
                            <el-radio-group v-model="datas.immunological_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="药物名称" v-if="datas.immunological_therapy==1">
                            <el-input v-model="datas.it_drug_name" placeholder="请输入药物名称"></el-input>
                        </el-form-item>
                        <el-form-item label="PARP抑制剂治疗">
                            <el-select v-model="datas.parp">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="奥拉帕利" value="1"></el-option>
                                <el-option label="尼拉帕尼" value="2"></el-option>
                                <el-option label="雷卡帕尼" value="3"></el-option>
                                <el-option label="其他" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="药物名称" v-if="datas.parp==4">
                            <el-input v-model="datas.parp_detail" placeholder="请输入药物名称"></el-input>
                        </el-form-item>
                        <el-form-item label="其他治疗">
                            <el-radio-group v-model="datas.other_treatment">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="药物名称" v-if="datas.other_treatment==1">
                            <el-input v-model="datas.other_treatment_name" placeholder="请输入药物名称"></el-input>
                        </el-form-item>
                        <el-form-item label="是否进行靶向治疗">
                            <el-radio-group v-model="datas.targeted_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="手术">
                            <el-select v-model="datas.operative_type">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="初始肿瘤细胞减灭术" value="1"></el-option>
                                <el-option label="间歇性肿瘤细胞减灭术" value="2"></el-option>
                                <el-option label="二次细胞减灭术" value="3"></el-option>
                                <el-option label="保留生育手术" value="4"></el-option>
                                <el-option label="预防性双侧乳腺切除术" value="5"></el-option>
                                <el-option label="预防性双侧输卵管卵巢切除" value="6"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="手术年龄" v-if="datas.operative_type==5">
                            <el-input v-model="datas.cut_breast_age" placeholder="请输入手术年龄"></el-input>
                        </el-form-item>
                        <el-form-item label="手术年龄" v-if="datas.operative_type==6">
                            <el-input v-model="datas.cut_tuboovarian_age" placeholder="请输入手术年龄"></el-input>
                        </el-form-item>
                        <el-form-item label="是否患过乳腺相关病史">
                            <el-radio-group v-model="datas.breast_history">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否患有多囊卵巢综合征">
                            <el-radio-group v-model="datas.pcos">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 遗传性肿瘤综合征表型信息 -->
                <div class="table-title">遗传性肿瘤综合征表型信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="患有黑斑性息肉">
                            <el-radio-group v-model="datas.blackspot_polyp">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="个数" v-if="datas.blackspot_polyp==1" prop="blackspot_number" :rules="[{ required: true, message: '不能为空'},{ type: 'number', message: '必须为数字值'}]">
                            <el-input v-model.number="datas.blackspot_number" placeholder="请输入个数"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="黑斑性息肉病家族史">
                            <el-radio-group v-model="datas.blackspot_family_history">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="皮肤黏膜色素沉着过度">
                            <el-radio-group v-model="datas.hyperpigmentation">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 基因检测信息 -->
                <div class="table-title">基因检测信息</div>
                <div id="my-table-title">
                    <el-row display="flex" align="middle" justify="space-between">
                        <el-col span="3">操作</el-col>
                        <el-col span="4">基因</el-col>
                        <el-col span="4">转录本号</el-col>
                        <el-col span="4">变异位点</el-col>
                        <el-col span="3">检测类型</el-col>
                        <el-col span="3">功能改变</el-col>
                        <el-col span="3">突变类型</el-col>
                    </el-row>
                </div>

                <div class="MyMainTable" v-for="(item,index) in datas.results" :key="item.id">
                    <el-row>
                        <el-col span="3">
                            <i class="el-icon-plus" @click="addGenejcInfo(index)"></i>
                            <i class="el-icon-minus" @click="deleteGenejcInfo(index)"></i>
                        </el-col>
                        <el-col span="4">
                            <el-form-item>
                                <el-input v-model="item.detection_result_gene" placeholder="只能输入大写字母和数字"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_trans" placeholder="请输入转录本号"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_varia" placeholder="请输入变异位点"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.assay_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="全基因组" value="1"></el-option>
                                    <el-option label="全外显子检测" value="2"></el-option>
                                    <el-option label="panel检测" value="3"></el-option>
                                    <el-option label="sanger测序" value="4"></el-option>
                                    <el-option label="MLPA" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.functional_change" v-show="item.functional_change != 6">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="错义突变" value="1"></el-option>
                                    <el-option label="无义突变" value="2"></el-option>
                                    <el-option label="移码突变" value="3"></el-option>
                                    <el-option label="同义突变" value="4"></el-option>
                                    <el-option label="剪接位点突变" value="5"></el-option>
                                    <el-option label="其他" value="6"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item v-if="item.functional_change==6" label-width="0">
                                <el-input v-model="item.other_function_change"></el-input>
                                <i class="el-icon-error" @click="shouFunctionalChange(index)"></i>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.mutation_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="致病的" value="1"></el-option>
                                    <el-option label="可能致病的" value="2"></el-option>
                                    <el-option label="意义不明确的" value="3"></el-option>
                                    <el-option label="可能良性的" value="4"></el-option>
                                    <el-option label="良性的" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>

                <!-- 生活方式 -->
                <div class="table-title">生活方式</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="吸烟">
                            <el-radio-group v-model="datas.smoking">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="吸烟频率" v-if="datas.smoking==1">
                            <el-row type="flex">
                                <el-col span="6">
                                    <el-input v-model="datas.smoking_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append"></template> -->
                                    </el-input>
                                    包/周&nbsp;&nbsp;X
                                </el-col>
                                <el-col span="12">
                                    <el-input v-model="datas.smoking_year" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">年</template> -->
                                    </el-input>
                                    年
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="饮酒">
                            <el-radio-group v-model="datas.drink">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="饮酒频率" v-if="datas.drink==1">
                            <el-row type="flex">
                                <el-col span="12">
                                    <el-input v-model="datas.drink_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">次/周</template> -->
                                    </el-input>
                                    次/周
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="高脂高红肉类饮食">
                            <el-radio-group v-model="datas.fatty_meat">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="每日蔬菜摄入量">
                            <el-select v-model="datas.vegetable_consum">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="≥500mg" value="1"></el-option>
                                <el-option label="＜500mg" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="每日运动消耗量">
                            <el-select v-model="datas.dec">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="基本无运动量" value="1"></el-option>
                                <el-option label="30-50大卡" value="2"></el-option>
                                <el-option label="50-100大卡" value="3"></el-option>
                                <el-option label="100-200大卡" value="4"></el-option>
                                <el-option label="200-300大卡" value="5"></el-option>
                                <el-option label="＞300大卡" value="6"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="体重(kg)">
                            <el-input v-model="datas.weight" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="身高(cm)">
                            <el-input v-model="datas.height" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="BMI">
                            <div>{{ datas.bmi }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-card class="box-card footer-card">
                    <div slot="header" class="clearfix">
                        <Button style="float: right; margin-left:20px;" @click="onClose">取消</Button>
                        <Button type="primary" style="float: right;" @click="onSave">保存</Button>
                    </div>
                </el-card>
            </el-form>
        </div>
    </div>
</template>
<script>
import { getCookie } from "common/js/cookie.js";
import { familyTree } from "api/basic/familyTree/familyTree.js";
export default {
    name: "lca", //卵巢癌
    data() {
        return {
            datas: {
                pathology_type: "", //组织病理类型
                figo: "", //FIGO分期
                menopause: "2", //是否绝经
                menopause_age: "", //绝经年龄
                primary_age: "", //初次月经年龄
                fertility_circumstance: "", //生育情况
                first_childbearing_age: "", //初次生育年龄
                children_number: "", //子女个数
                breast_feeding: "2", //是否母乳喂养
                nursing_time: "", //哺乳时间
                oral_contraceptive: "2", //服用口服避孕药
                oral_contraceptive_time: "", //连续服用时间
                operative_type: "", //手术
                cut_breast_age: "", //手术年龄
                cut_tuboovarian_age: "", //手术年龄
                platinum_chemotherapy: "2", //铂类化疗
                pcn: "", //铂类化疗次数
                is_sensitive_platinum: "2", //铂类化疗敏感
                parp: "", //PARP抑制剂治疗
                parp_detail: "", //药物名称
                immunological_therapy: "2", //免疫治疗
                it_drug_name: "", //免疫治疗具体信息
                other_treatment: "2", //其他治疗
                other_treatment_name: "", //药物名称
                hrt: "2", //是否进行激素代替疗法
                blackspot_polyp: "2", //患有黑斑性息肉个数
                blackspot_number: "", //患有黑斑性息肉
                blackspot_family_history: "2", //黑斑性息肉病家族史
                hyperpigmentation: "2", //皮肤黏膜色素沉着过度
                peritoneal_cancer: "2", //是否伴有腹膜癌
                hh: "", //激素治疗史
                targeted_therapy: "2", //是否进行靶向治疗
                breast_history: "2", //是否患过乳腺相关病史
                pcos: "2", //是否患有多囊卵巢综合征
                results: [
                    {
                        detection_result_gene: "", //基因
                        detection_result_trans: "", //转录本号
                        detection_result_varia: "", //变异位点
                        assay_type: "", //检测类型
                        functional_change: "", //功能改变
                        other_function_change: "", //其他
                        mutation_type: "" //突变类型
                    }
                ],
                smoking: "2", //吸烟
                smoking_cycle: "", //吸烟频率
                smoke_year: "", //吸烟年限
                drink: "2", //饮酒
                drink_cycle: "", //饮酒频率
                fatty_meat: "2", //高脂高红肉类饮食
                vegetable_consum: "", //每日蔬菜摄入量
                dec: "", //每日运动消耗量
                weight: "", //体重
                height: "", //身高
                bmi: "" //BNI
            },
            loading: true,
            postParams: {}
        };
    },
    computed() {},
    watch: {
        datas: {
            handler: function(newVal) {
                // 服用避孕药时间清空
                if (newVal.oral_contraceptive != 1) {
                    this.datas.oral_contraceptive_time = "";
                }
                // 绝经年龄清空
                if (newVal.menopause != 1) {
                    this.datas.menopause_age = "";
                }
                // 生育年龄与子女个数清空
                if (newVal.fertility_circumstance != 1) {
                    this.datas.first_childbearing_age = "";
                    this.datas.children_number = "";
                    this.datas.breast_feeding = "";
                    this.datas.nursing_time = "";
                }
                // 哺乳时间清空
                if (newVal.breast_feeding != 1) {
                    this.datas.nursing_time = "";
                }
                // 铂类化疗
                if (newVal.platinum_chemotherapy != 1) {
                    this.datas.pcn = "";
                }
                // 免疫治疗
                if (newVal.immunological_therapy != 1) {
                    this.datas.it_drug_name = "";
                }
                // PARP抑制剂治疗
                if (newVal.parp != 4) {
                    this.datas.parp_detail = "";
                }
                // 其他治疗
                if (newVal.other_treatment != 1) {
                    this.datas.other_treatment_name = "";
                }
                // 手术年龄
                if (newVal.operative_type != 5) {
                    this.datas.cut_breast_age = "";
                }
                // 手术年龄
                if (newVal.operative_type != 6) {
                    this.datas.cut_tuboovarian_age = "";
                }
                // 患有黑斑性息肉
                if (newVal.blackspot_polyp != 1) {
                    this.datas.blackspot_number = "";
                }
                // 吸烟
                if (newVal.smoking != 1) {
                    this.datas.smoking_cycle = "";
                    this.datas.smoking_year = "";
                }
                // 饮酒
                if (newVal.drink != 1) {
                    this.datas.cut_tuboovarian_age = "";
                }
            },
            deep: true
        }
    },
    components: {},
    created() {},
    mounted() {
        document.title = "卵巢癌辅助信息";
        //获取辅助信息
        this.postParams.userId = getCookie("userid");
        this.postParams.familyTreeId = M.url().familyTreeId;
        this.postParams.familyUserId = M.url().current_personid;
        this.postParams.cancerId = M.url().cancerId;
        console.log(this.postParams);
        familyTree
            .findOneFromCancer(this.postParams)
            .then(res => {
                if (res.returnCode == 0) {
                    if (res.data && res.data.familyCancer) {
                        this.datas = { ...res.data.familyCancer };
                        this.$Message.success("数据加载成功");
                    }
                } else {
                    this.$Message.error("数据加载失败");
                }
                this.loading = false;
            })
            .catch(error => {
                this.loading = false;
            });
    },
    methods: {
        onClose() {
            window.close();
        },
        onSave() {
            this.loading = true;
            this.postParams.familyCancer = this.datas;
            familyTree
                .saveOrUpdateCancerForm(this.postParams)
                .then(res => {
                    if (res.returnCode == 0) {
                        this.$Message.success("数据保存成功");
                    } else {
                        this.$Message.error("数据保存失败");
                    }
                    this.loading = false;
                })
                .catch(err => {
                    this.loading = false;
                });
        },
        addGenejcInfo(index) {
            let obj = {
                detection_result_gene: "", //基因
                detection_result_trans: "", //转录本号
                detection_result_varia: "", //变异位点
                assay_type: "", //检测类型
                functional_change: "", //功能改变
                other_function_change: "", //其他
                mutation_type: "" //突变类型
            };
            ++index;
            this.datas.results.splice(index, 0, obj);
        },
        deleteGenejcInfo(index) {
            if (this.datas.results.length <= 1) {
                this.$Message.info("最少为一条，不可删除了");
                return;
            }
            this.datas.results.splice(index, 1);
        },
        shouFunctionalChange(index) {
            this.datas.results[index].functional_change = "";
            this.datas.results[index].other_function_change = "";
        },
        getBmi() {
            let bmi =
                Math.round(
                    this.datas.weight /
                        Math.pow(this.datas.height / 100, 2) *
                        100
                ) / 100;
            if (isNaN(bmi) || bmi == Infinity) {
                this.datas.bmi = "";
            } else {
                this.datas.bmi = bmi;
            }
        }
    }
};
</script>
 